<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

</body>
</html>


<html>
<head  lang="en">
    <meta charset="UTF-8">
    <title>贤明兄的java web的学习之路</title>
    <!--<link href="http://www.cnblogs.com/Content/Site.css" rel="stylesheet" />-->
    <script src="http://mgt.zhuanlingyong.com/scripts/libs/jquery-form.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        // TODO Add script
//        function find() {
//            var id = $('#prodId').val();
//            $.getJSON("api/products/" + id,
//                    function (data) {
//                        var str = data.Name + ': $' + data.Price;
//                        $('#product').text(str);
//                    })
//                    .fail(
//                    function (jqXHR, textStatus, err) {
//                        $('#product').text('Error: ' + err);
//                    });
//        }
//        function showAll() {
//            $("#showProducts li").remove();
//            $.getJSON("api/user/AllUser",
//                    function (data) {
//                        $.each(data, function (key, val) {
//                            var str = '用户名' + val.userName ;
//                            $('<li/>', { text: str })
//                                    .appendTo($('#showProducts'));
//                        });
//                    });
//
//        }
//        function countuser() {
//            $("#show").removeData();
//            $.get("api/User/UserCount", function (data) {
//                var str = data;
//                //str.appendTo($('#show'));
//
//                $('#show').text(str)
//            })
//
//        }
        function validate() {
            var userName = document.forms[0].userName.value;
            var userNameFirst = userName.substring(0, 1);
            var passWord = document.forms[0].passWord.value;
            var passWord1 = document.forms[0].passWord1.value;

            if (userName.length <= 0){
                document.getElementById("alert").textContent = "用户名不能为空！";

            }
            else if (userNameFirst < 97 || userNameFirst > 122) {
                document.getElementById("alert").textContent = "用户名首字母必须小写字母！";
            }
            else if (passWord <= 0)
                document.getElementById("alert").textContent = "密码不能为空！";
            else if (passWord1.length <= 0)
                document.getElementById("alert").textContent = "重新输入密码不能为空！";
            else if (userName.length < 6)
                document.getElementById("alert").textContent = "用户名不能小于6！";
            else if (passWord != passWord1)
                document.getElementById("alert").textContent = "两次输入密码不一致！";
            else {
                alert("验证通过，表单可以提交！");
//                document.forms[0].submit();
            }
        }
    </script>

</head>
<body id="body">
<div align="center">
    <div>
        <h1 id="alert">注册</h1>
    </div>

    <form action="api/User/UserSave" method="post" enctype="application/x-www-form-urlencoded">
        <div>
            <input type="text" name="userName" placeholder="用户名" />
        </div>
        <div>
            <input type="text" name="passWord" placeholder="密码" />
        </div>
        <div>
            <input type="text" name="passWord1" placeholder="确认密码" />
        </div>
        <div>
            <input type="button" value="注册" onclick="validate()" />
        </div>
    </form>

    <table>
        <tr>
            <td id="mousemove" onmouseover="countuser()">当前注册人数:</td>
            <td id="show"></td>
        </tr>

    </table>



    <div>
        <input type="button" value="都有这些人注册了" onclick="showAll()" />
        <p id="showProducts" />
    </div>

</div>
</body>
</html>